<template>
  <div class="ZHuaNTi">
    <ul>
      <li v-for="item in shuJu" :key="item.id">
        <img v-lazy="item.scene_pic_url" alt="" />
        <p class="p1">{{ item.title }}</p>
        <p class="p2">{{ item.subtitle }}</p>
        <p class="p3">{{ item.price_info | formatMoney }}</p>
      </li>
    </ul>
    <van-pagination
      v-model="page"
      :page-count="totalPages"
      mode="simple"
      @change="changeFn"
    />
  </div>
</template>

<script>
// 导入首页接口请求
// 解构赋值导入http.js里边的首页的接口函数
import { getZHuaNTiData } from "@/utils/http";

export default {
  name: "ZHuaNTi",
  data() {
    return {
      page: 1, //默认页数
      size: 10, //每页多少条数据
      shuJu: [],
      totalPages: "",
    };
  },
  created() {
    this.changeFn();
  },
  methods: {
    changeFn() {
      getZHuaNTiData({
        page: this.page,
        size: this.size,
      }).then((res) => {
        // console.log(res);
        this.shuJu = res.data.data.data;
        this.totalPages = res.data.data.totalPages;
      });
    },
  },
};
</script>

<style lang='less' scoped>
.ZHuaNTi {
  text-align: center;
  img {
    width: 100%;
    display: block;
  }
  p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .p1 {
    font-size: 18px;
    // line-height: 27px;
    margin-top: 22px;
    margin-bottom: 22px;
  }
  .p2 {
    font-size: 16px;
    color: #1f1f1f;
    margin-top: 27px;
    margin-bottom: 27px;
  }
  .p3 {
    font-size: 18px;
    color: #9b0000;
    margin-bottom: 35px;
  }
}
</style>